﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<GlobalTask>" %>
<%@ Import Namespace="ViewRes" %>

<%--<script type="text/javascript">
    $(function () {
        $("#StartDate").change(function () {
            var date = $(this).val();
            if (date.replace(/^\\s+|\\s+$/, '').length != 0 && isNaN(Date.parse(date))) {
                alert("Введенная дата не верна");
            }
            else {
                loadGlobalTasksByLevelAndPlaning('QualificationLevelId', 'PlaningTypeId', 'PrevCheckPointId', 'StartDate');
            }
        });
    });
</script>--%>

<div class="container">
    <%
        using (
            Ajax.BeginRouteForm("Default", new {controller = "GlobalTasks", action = "Edit", id = Model.CheckPointId},
                                new AjaxOptions
                                    {HttpMethod = "POST"}))
        {%>
    <%:Html.HiddenFor(s => s.CheckPointId)%>
    <span>
        <%:Html.DropDownList("QualificationLevelId", (IEnumerable<SelectListItem>) ViewData["Levels"],
                                                new
                                                    {
                                                        onchange =
                                                    "loadGlobalTasksByLevelAndPlaning('QualificationLevelId','PlaningTypeId','PrevCheckPointId','StartDate')"
                                                    })%>
    </span><span>
        <%:Html.DropDownList("PlaningTypeId", (IEnumerable<SelectListItem>) ViewData["PlaningTypes"],
                                                new
                                                    {
                                                        onchange =
                                                    "loadGlobalTasksByLevelAndPlaning('QualificationLevelId','PlaningTypeId','PrevCheckPointId','StartDate')"
                                                    })%>
    </span>   
    <table>
        <tr>
            <td>
                <%:SharedStrings.Name%>
            </td>
            <td>
                <%:Html.TextBoxFor(gt => gt.Name)%>
            </td>
        </tr>
         <tr>
            <td>
                <%:SharedStrings.Description%>
            </td>
            <td>
                <%:Html.TextBoxFor(gt => gt.Description)%>
            </td>
        </tr>
        <tr>
            <td>
                <%:SharedStrings.Date%>
            </td>
            <td>
                <%:Html.TextBoxFor(model => model.StartDate, new {id = "StartDate"})%>
            </td>
        </tr>        
        <tr>
            <td>
                <%:SystemManagersStrings.CanLecturerEdit%>
            </td>
            <td>
                <%:Html.EditorFor(gt => gt.CanStatusByLecturerEditing)%>
            </td>
        </tr>
        <tr>
            <td>
                <%:SystemManagersStrings.RemindIn%>
            </td>
            <td>
                <%:Html.TextBoxFor(gt => gt.RemindInDays)%>
            </td>
            <td>
                <%:SystemManagersStrings.Days%>
            </td>
        </tr>
    </table>
    <div style="float: right">
        <input type="submit" value="OK" />
    </div>
    <%
        }%>
</div>
